import multiChannel from '../../../api/config/channel/multi-channel'
import * as globalTypes from '../../../mutation-types'
/* 满意度配置 start */
/**
 * 获取远程控制满意度配置
 * @returns {*}
 */
export const getRemoteControlCSRDic = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.getRemoteControlCSRDic(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
/**
 * 保存满意度配置
 * @param data {}
 * data._id
 * @param data.type webchatCSR
 * data.options [{key: '' index: '' name: '' reason []}]
 * @returns {*}
 */
export const saveRemoteControlCSRDic = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.saveRemoteControlCSRDic(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
/**
 * 获取远程控座席
 * @param data
 * @returns {*}
 */
export const getExtenAssignRecord = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.getExtenAssignRecord(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
/**
 * 保存远程控座席
 * @param data
 * @returns {*}
 */
export const saveExtenAssignRecord = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.saveExtenAssignRecord(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
/**
 * 获取远程控座席
 * @param data
 * @returns {*}
 */
export const getTranslationConfig = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.getTranslationConfig(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
/**
 * 保存远程控座席
 * @param data
 * @returns {*}
 */
export const updateTranslationConfig = ({commit, state, rootState, dispatch}, data) => {
  return multiChannel.updateTranslationConfig(data)
    .then(response => {
      return response
    })
    .catch(() => {
      commit(globalTypes.SET_ERROR, 'message.default_tips')
    })
}
